Refactor GtkApplication
authorRyan Lortie <desrt@desrt.ca>
Mon, 16 Dec 2013 14:32:13 +0000 (09:32 -0500)
committerRyan Lortie <desrt@desrt.ca>
Mon, 16 Dec 2013 18:51:54 +0000 (13:51 -0500)
commit7fd81cf111863f819238431488b8ab0f0b943d68
treea4fe8229064c6256269b2b9579a628163a673d22
parent2841c0ec542262218fd805443aaa5ca3cca6d6a0
Refactor GtkApplication

gtkapplication.c has turned into a bit of an #ifdef mess over time, and
many of the current checks are incorrect.  As an example, if you build
Gtk for wayland, and exclude the X11 backend, much of the functionality
required by wayland (such as exporting menu models) will be disabled.

Solve that by introducing a backend mechanism to GtkApplication (named
GtkApplicationImpl) similar to the one in GApplication.  Add backends
for Wayland, X11 and Quartz, with X11 and Wayland sharing a common
'DBus' superclass.

                             GtkApplicationImpl
                                      |
                       /--------------+-------------------\
                       |                                  |
            GtkApplicationImplDBus              GtkApplicationImplQuartz
                       |
           /-----------+-----------------\
           |                             |
  GtkApplicationImplX11      GtkApplicationImplWayland

GtkApplicationImpl itself is essentially a bunch of vfuncs that serve as
hooks for various things that the platform-specific backends may be
interested in doing (startup, shutdown, managing windows, inhibit, etc.)

With this change, all platform specific code has been removed from
gtkapplication.c and gtkapplicationwindow.c (both of which are now free
of #ifdefs, except for a UNIX-specific use of GDesktopAppInfo in
gtkapplicationwindow.c).

Additionally, because of the movement of the property-setting code out
of GtkApplicationWindow, the _GTK_APPLICATION_ID properties (and
friends) will be set on non-GtkApplicationWindows, such as dialogs.

https://bugzilla.gnome.org/show_bug.cgi?id=720550
gtk/Makefile.am
gtk/gtkapplication-dbus.c [new file with mode: 0644]
gtk/gtkapplication-quartz.c [new file with mode: 0644]
gtk/gtkapplication-wayland.c [new file with mode: 0644]
gtk/gtkapplication-x11.c [new file with mode: 0644]
gtk/gtkapplication.c
gtk/gtkapplicationimpl.c [new file with mode: 0644]
gtk/gtkapplicationprivate.h
gtk/gtkapplicationwindow.c
gtk/gtkwindow.c